Skip to content

fix(ci): don't fail scoped test selection when zero test files match#8167

Merged
JSONbored merged 1 commit into
mainfrom
fix/ci-scoped-selection-zero-test-files
Jul 23, 2026
Merged

fix(ci): don't fail scoped test selection when zero test files match#8167
JSONbored merged 1 commit into
mainfrom
fix/ci-scoped-selection-zero-test-files

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • A PR whose scoped-selection paths (backend/miner/mcp/discoveryIndex) only touch files no test imports -- e.g. a pure docs-only change under packages/loopover-miner/docs/** -- correctly triggers scoped test selection (vitest --changed=origin/main), which then correctly finds nothing to run ("No test files found, exiting with code 0"). That legitimate outcome writes no coverage/lcov.info, which "Verify coverage report exists" treated as a hard failure regardless of cause.
  • Confirmed live: docs(discovery-plane): finalize operator guide now that the plane is shipped and live #8165 (packages/loopover-miner/docs + apps/loopover-ui/content/docs mdx only) failed all 3 validate-tests shards this way despite nothing being broken.
  • Captures vitest's own "No test files found" stdout in the scoped branch and skips the coverage-existence check specifically for that case. A real failure (tests ran and failed, or the step crashed before producing output) still fails the job exactly as before -- this only widens what counts as a legitimate zero-coverage outcome, it doesn't loosen any real check.

Test plan

  • Workflow-only change to .github/workflows/ci.yml; no src/** changes, so no Codecov impact.
  • actionlint .github/workflows/ci.yml passes.
  • This PR's own CI run should confirm the fix path isn't hit here (this PR touches .github/workflows/**, which isn't a scoped-selection path, so it runs the full suite as normal) -- the real verification is docs(discovery-plane): finalize operator guide now that the plane is shipped and live #8165 going green once this merges and re-triggers it.

A PR whose scoped-selection paths (backend/miner/mcp/discoveryIndex) only
touch files no test imports -- e.g. a pure docs-only change under
packages/loopover-miner/docs/** -- correctly triggers scoped test selection
(vitest --changed=origin/main), which then correctly finds nothing to run
("No test files found, exiting with code 0"). That legitimate outcome wrote
no coverage/lcov.info, which "Verify coverage report exists" treated as a
hard failure regardless of cause.

Confirmed live: PR #8165 (packages/loopover-miner/docs + apps/loopover-ui/
content/docs mdx only) failed all 3 validate-tests shards this way despite
nothing being broken.

Captures vitest's own "No test files found" stdout in the scoped branch and
skips the coverage-existence check specifically for that case, while a real
failure (tests ran and failed, or the step crashed before producing output)
still fails the job exactly as before.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 23, 2026
@JSONbored
JSONbored merged commit e9adc75 into main Jul 23, 2026
9 of 10 checks passed
@JSONbored
JSONbored deleted the fix/ci-scoped-selection-zero-test-files branch July 23, 2026 07:53
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 23, 2026
@JSONbored
JSONbored restored the fix/ci-scoped-selection-zero-test-files branch July 23, 2026 08:00
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
20673 1 20672 17
View the top 1 failed test(s) by shortest run time
test/unit/codecov-policy.test.ts > Codecov policy > fails closed when the backend coverage report is missing or cannot upload
Stack Traces | 0.181s run time
AssertionError: expected '${{ success() && steps.coverage.outpu…' to be '${{ success() }}' // Object.is equality

Expected: "${{ success() }}"
Received: "${{ success() && steps.coverage.outputs.no_tests_matched != 'true' }}"

 ❯ test/unit/codecov-policy.test.ts:62:35

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

JSONbored added a commit that referenced this pull request Jul 23, 2026
…ults upload step (#8173)

#8167 taught the verify step that a scoped selection matching zero test files
writes no report and is not a failure -- but left every upload step below it
unguarded, so the trusted/fork coverage uploads (fail_ci_if_error: true) would
still turn that non-event red on the missing lcov, and the junit uploads would
noisily fail on a missing xml. It also left codecov-policy.test.ts pinning the
old verify condition, which broke that suite on main for every branch.

Adds the same steps.coverage.outputs.no_tests_matched guard to all five upload
steps and re-pins the policy test to the completed invariant: the escape hatch
exists exactly once, and every upload below the verify step carries it.
JSONbored added a commit that referenced this pull request Jul 23, 2026
…8174)

#8167 fixed the per-shard --changed case (exits 0 with "No test files
found"), but --mergeReports exits 1 for the same condition -- a different
code path, not covered by that fix. Confirmed live: PR #8168 (the same
docs-only PR #8167 was meant to unblock) passed all 3 validate-tests shards
but still failed validate-tests-merge with "No test files found, exiting
with code 1", even with COVERAGE_NO_THRESHOLDS already disabling the
threshold check.

Only treats that exact case as success, and only when COVERAGE_NO_THRESHOLDS
is set (i.e. this run is the scoped case to begin with) -- in the unscoped
full-suite case, "no test files found" while merging is still a real
failure worth surfacing loudly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant